<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@include file="common/header.jsp"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="zh">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>商家信息修改</title>
</head>
<body>
<div id="page-wrapper">
	<div id="page-inner">
		<!-- /. ROW  -->
		

		<!-- /.col-lg-6 (nested) -->
		<div class="col-lg-12">
			<%-- <form role="form" method="post"
            enctype="multipart/form-data" action="${pageContext.request.contextPath }/provider/addsave"> --%>
			<section id="contact" style="background-color: #fff;" class="text-page pb-4">
				<div class="container">
					<div class="row">
						<div class="col-md-12">
							<div class="row">
								<div class="col-md-2">
									<h3 class="heading">
										当前商家信息
									</h3>
								</div>

							</div>


							<br />
							<div class="row">
								<div class="col-md-6">
									<form id="contact-form" method="post" action="${pageContext.request.contextPath }/provider/modify.html"
										class="contact-form" enctype="multipart/form-data">
										<div class="controls">
											<%-- <input type="hidden" name="hotelName"
												value="${room.hotelName }">
												<input type="hidden" name="room_id"
												value="${room.room_id }"> --%>
											
											<div class="row">
												<div class="col-md-6">
													<div class="form-group">
														<label for="proCode">商家编码*</label> <input type="text"
															name="proCode" readonly="readonly"
														 class="form-control" value="${providerSession.proCode }">
													</div>
												</div>
											</div>	
											<div class="row">
												<div class="col-md-6">
													<div class="form-group">
														<label for="proName">商家名字 *</label> <input type="text"
															name="proName" placeholder="Enter your firstname" id="proName"
															required="required" class="form-control" value="${providerSession.proName }">
													</div>
												</div>
											</div>
											<div class="row">
												<div class="col-md-6">
													<div class="form-group">
														<label for="proPhone">联系电话*</label> <input type="text"
															name="proPhone" required="required"
														 class="form-control" value="${providerSession.proPhone }">
													</div>
												</div>
											</div>	
											<div class="row">
												<div class="col-md-6">
													<div class="form-group">
														<label for="proAddress">联系地址*</label> <input type="text"
															name="proAddress" required="required" id="proAddress"
														 class="form-control" value="${providerSession.proAddress }">
													</div>
												</div>
											</div>	
											<div class="row">
												<div class="col-md-6">
													<div class="form-group">
														<label for="proFax">传真*</label> <input type="text"
															name="proFax" required="required"
														 class="form-control" value="${providerSession.proFax }">
													</div>
												</div>
											</div>	
											
											<div class="form-group" id="div1">
												<label for="org_PicPath">营业执照 *</label> <input type="file"
													name="org_PicPath" id="org_PicPath" 
													class="form-control" value="${providerSession.org_PicPath }">
													<span>${error}</span>
											</div>
											
											
											<br/><br/>
											<br/><br/>
											<div class="col-md-2 col-md-push-2">
												<button type="submit" class="btn btn-danger" id="btn1">提交保存</button>
											</div>
											<div class="col-md-2 col-md-push-4">
												<span class='btn btn-primary'><a
													href='${pageContext.request.contextPath }/provider/pwd'
													style="color:white;">修改密码</a></span>
											</div>
											<div class="col-md-2 col-md-push-6">
												<input type="button" id="backbtn" value="返回上页"
													class='btn btn-success' />
											</div>

										</div>
									</form>
								</div>
								<br />
								
							</div>
						</div>
					</div>
				</div>
				
			</section>
    
    		
    
			<!-- </form> -->
		</div>
		<!-- /.col-lg-6 (nested) -->
	</div>
	<!-- /.row (nested) -->
</div>

<footer>
	<p>
		Copyright &copy; 2016.Company name All rights reserved.More Templates
		<a href="http://www.cssmoban.com/" target="_blank" title="模板之家">模板之家</a>
		- Collect from <a href="http://www.cssmoban.com/" title="网页模板"
			target="_blank">网页模板</a>
	</p>
</footer>


<!-- JS Scripts-->
    <!-- jQuery Js -->
    <%@include file="common/js.jsp"%>
<script>
	$('#backbtn').on("click", function() {
    			history.back(-1);
    		});
    //判断是否有这个商家
    	$('#proName').on("change", function() {
    		var pname = $('#proName').val();
    		var paddress = $("#proAddress").val();
    		isExist();
    	});
    
    	$('#proAddress').on("change", function() {
    		var pname = $('#proName').val();
    		var paddress = $("#proAddress").val();
    		isExist();
    	});
    
    
    	function isExist() {
    		var pname = $('#proName').val();
    		var paddress = $("#proAddress").val();
    
    		$.ajax({
    			url : "/Trip/provider/proExist",
    			data : {
    				pname : pname,
    				address : paddress
    			},
    			dataType : "json",
    			success : function(data) {
    				if (data == "noexist") { //如果已经存在，就返回提示信息
    					$('#proName').next().html("")
    				} else {
    					$('#proName').next().html("该商品已存在，请重新填入")
    					$('#proName').val("");
    					$("#proAddress").val("");
    				}
    			},
    			error : function(data) {
    				alert("验证失败");
    			}
    		});
    	}	

</script>

</body>
</html>